import HttpAxios from "../../components/http/HttpAxios";
import {GiftGoodsDomain} from "./GiftGoodsDomain";
import {GiftOrderProcessDomain} from "./GiftOrderProcessDomain";

class GiftGoodsService{

  baseUrl = process.env.REACT_APP_POINT_SHOPPING_URL;
  httpClient= new HttpAxios();

  queryListUtl="/point-shopping/goods/list";
  uploadImage="/point-shopping/admin/goods/save";
  updateGiftUrl="/point-shopping/admin/goods/update";
  giftOrderProcessUrl = "/point-shopping/goods-order/generate";

  queryList(call):GiftGoodsDomain[]{
    const body =  this.httpClient.post(this.baseUrl+this.queryListUtl,{},call);
    const emptyArray=[];
    return emptyArray;
  }

  addGiftGoods(token:string,data,call){
    const body =  this.httpClient.sendFIle(this.uploadImage,token,data,call);
  }

  updateGiftGoods(token:string,data,call){
    const body =  this.httpClient.postAndToken(this.baseUrl+this.updateGiftUrl,data,token,call);
  }

  giftOrderProcess(token:string,data:GiftOrderProcessDomain,call){
    this.httpClient.postAndToken(this.baseUrl+this.giftOrderProcessUrl,data,token,call);
  }

}

export default GiftGoodsService;
